<?php
namespace Modules\Config\Entity;

use Core\Mvc\Entity\Adapter\Config as BaseConfigEntity;

/**
 */
class Config extends BaseConfigEntity
{
    /**
     * @var string
     */
    protected $_entity = 'config';

    /**
     * @return array
     */
    public function getLinks()
    {
        if (!$this->_links) {
            $this->_links = [
                'edit' => [
                    'href' => [
                        'for' => 'adminConfigEdit',
                        'configId' => $this->contentModel,
                    ],
                    'data-target' => 'right_handle',
                    'icon' => 'info',
                    'name' => '配置',
                ],
            ];
        }
        return parent::getLinks();
    }

    /**
     * @param array|null $params
     * @return \Generator
     */
    public static function find(array $params = null)
    {
        $params['_entity'] = 'config';
        return parent::find($params);
    }

    /**
     * @param array|null $params
     * @return BaseConfigEntity
     */
    public static function findFirst(array $params = null)
    {
        $params['_entity'] = 'config';
        return parent::findFirst($params);
    }
}
